#include <iostream>
#include "managerview_console_impl.h"
#include "managerservice_impl.h"
#include "getch.h"
using namespace std;

 ManagerViewConsoleImpl:: ManagerViewConsoleImpl(void)
 {
	home = new ManagerServiceImpl;
 }

void ManagerViewConsoleImpl::menu(void)
{
	while(1)
	{
		system("clear");
		cout << "1.添加管理员" << endl;
		cout << "2.删除管理员" << endl;
		cout << "3.显示管理员" << endl;
		cout << "4.退出" 	   << endl;
		cout << "输入相应的指令：" << endl;
		char ch = getch();
		switch(ch)
		{
			case '1':add();break;
			case '2':del();break;
			case '3':list();break;
			case '4':return;
		}

	}
}

void ManagerViewConsoleImpl::add(void)
{
	home->addManager();	
}

void ManagerViewConsoleImpl::del(void)
{
	home->deleteManager();
}

void ManagerViewConsoleImpl::list(void)
{
	home->listManager();
}



